home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / thor12.zip / THOR.LHA / rexx / NCommPoll.thor < prev    next >
Text File  |  1994-03-03  |  2KB  |  109 lines

  1. /* NCommPoll.thor ╖ by Troels Walsted Hansen
  2. ** $VER: NCommPoll.thor v1.2 (19.02.94)
  3. **
  4. ** An ARexx script that automates NComm dialing of:
  5. **  1) BBSs you select from a list of all BBSs defined in Thor.
  6. **  2) All BBSs with events.
  7. **  3) All BBSs.
  8. **
  9. ** IMPORTANT: To use this script, the BBSs configured in Thor must
  10. **            have the same name as those in your NComm phonebook.
  11. */
  12.  
  13. options results
  14.  
  15. if(substr(address(),1,4) ~= "THOR") then do
  16.     parse arg portname
  17.     if~(show(p, portname)) then do
  18.         if ~(show(p, "THOR.01")) then do
  19.             say "No THOR port found!"
  20.             exit
  21.         end
  22.         else portname = "THOR.01"
  23.     end
  24. end
  25. else portname = address()
  26.  
  27. address(portname)
  28.  
  29. /* Determine what user wants.. */
  30.  
  31. dialstring = ""
  32.  
  33. THORTOFRONT
  34. REQUESTNOTIFY TEXT '"Dial which?"' BT '"_Select|_Events|_All|_Cancel"'
  35.  
  36. /* Cancel */
  37.  
  38. if(result = 0) then do
  39.     exit
  40. end
  41.  
  42. /* Select */
  43.  
  44. if(result = 1) then do
  45.     THORTOFRONT
  46.  
  47.     do forever
  48.         REQUESTLIST BBSLIST
  49.         if(rc ~= 0) then break
  50.         else BBSName = result
  51.         dialstring = dialstring || "|" || BBSName
  52.     end
  53. end
  54.  
  55. /* Events */
  56.  
  57. if(result = 2) then do
  58.     address command("thor:bin/listevents short >t:ThorBBSs")
  59.     open(file, "t:ThorBBSs")
  60.  
  61.     do until(eof(file))
  62.         str = strip(delstr(readln(file), 23), T)
  63.         dialstring = dialstring || "|" || substr(str, 6)
  64.     end
  65.  
  66.     close(file)
  67. end
  68.  
  69. /* All */
  70.  
  71. if(result = 3) then do
  72.     GETBBSLIST STEM bbslist
  73.  
  74.     do i=1 to BBSLIST.COUNT
  75.         dialstring = dialstring || "|" || BBSLIST.i
  76.     end
  77. end
  78.  
  79. if(dialstring = "") then do
  80.     if(exists("T:ThorBBSs")) then address command "delete >nil: T:ThorBBSs"
  81.     exit
  82. end
  83.  
  84. /* Is NComm already running? If not, start it... */
  85.  
  86. if ~show('p', 'ncomm') then do
  87.     if ~exists("t:NCommStartupScript") then do
  88.         call open(nscript, "t:NCommStartupScript", W)
  89.         call writeln(nscript, "stack 10000")
  90.         call writeln(nscript, "cd NComm:")
  91.         call writeln(nscript, "run <>nil: NComm")
  92.         call close(nscript)
  93.     end
  94.  
  95.     address command
  96.         "execute t:NCommStartupScript"
  97.         "WaitForPort ncomm"
  98.     if(rc) then exit
  99. end
  100.  
  101. address 'ncomm'
  102. NCOMMTOFRONT
  103. DIAL strip(dialstring, B, "|")
  104.  
  105. /* Cleanup and exit... */
  106.  
  107. if(exists("T:ThorBBSs")) then address command "delete >nil: T:ThorBBSs"
  108. exit
  109.